
package GUI;

import java.awt.Dimension;
import java.awt.Toolkit;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JPanel;
import javax.swing.border.BevelBorder;

/**
 * This class provides an EmoticonsPanel Panel with buttons on it
 * @author Yaniv Kalif
 * @
 */
public class EmoticonsPanel extends JPanel
{
    ImageIcon[] _Images;//_images Array of EmoticonsPanel Images
    public JButton[] _Buttons;// @param _Buttons Array of JButtons
    public int _size;// _size number of active emoticons
   /**
    * Default Constructor
    * this costructor:
    * * loads the emoticons images/icons to the _Images array
    * * initializing the buttons for each emoticon
    */
    public EmoticonsPanel()
    {
            _size=13 ;
        _Images = new ImageIcon[_size];
            for(int i=0;i<_size;i++)
             _Images[i]=new ImageIcon();
         
            _Images[0].setImage(Toolkit.getDefaultToolkit().getImage("Pics/Emoticons/happy.gif"));
            _Images[1].setImage(Toolkit.getDefaultToolkit().getImage("Pics/Emoticons/sad.gif"));
            _Images[2].setImage(Toolkit.getDefaultToolkit().getImage("Pics/Emoticons/wink.png"));
            _Images[3].setImage(Toolkit.getDefaultToolkit().getImage("Pics/Emoticons/angry.gif"));
            _Images[4].setImage(Toolkit.getDefaultToolkit().getImage("Pics/Emoticons/xd.png"));
            _Images[5].setImage(Toolkit.getDefaultToolkit().getImage("Pics/Emoticons/confused.png"));
            _Images[6].setImage(Toolkit.getDefaultToolkit().getImage("Pics/Emoticons/frown.png"));
            _Images[7].setImage(Toolkit.getDefaultToolkit().getImage("Pics/Emoticons/lol.png"));
            _Images[8].setImage(Toolkit.getDefaultToolkit().getImage("Pics/Emoticons/biggrin.png"));
            _Images[9].setImage(Toolkit.getDefaultToolkit().getImage("Pics/Emoticons/neutral.png"));
            _Images[10].setImage(Toolkit.getDefaultToolkit().getImage("Pics/Emoticons/oh.png"));
            _Images[11].setImage(Toolkit.getDefaultToolkit().getImage("Pics/Emoticons/teeth.png"));
            _Images[12].setImage(Toolkit.getDefaultToolkit().getImage("Pics/Emoticons/winktongue.png"));
         //initilizing the Buttons
             _Buttons=new JButton[13];
             _Buttons[0]=new JButton( _Images[0]);
             _Buttons[0].setName("happy");
              _Buttons[1]=new JButton( _Images[1]);
             _Buttons[1].setName("sad");
             _Buttons[2]=new JButton( _Images[2]);
             _Buttons[2].setName("wink");
             _Buttons[3]=new JButton( _Images[3]);
             _Buttons[3].setName("angry");

              _Buttons[4]=new JButton( _Images[4]);
             _Buttons[4].setName("xd");
              _Buttons[5]=new JButton( _Images[5]);
             _Buttons[5].setName("confused");
             _Buttons[5].setLocation(10, 10);
              _Buttons[6]=new JButton( _Images[6]);
             _Buttons[6].setName("frown");
             _Buttons[7]=new JButton( _Images[7]);
             _Buttons[7].setName("lol");
             _Buttons[8]=new JButton( _Images[8]);
             _Buttons[8].setName("biggrin");
               _Buttons[9]=new JButton( _Images[9]);
             _Buttons[9].setName("neutral");
              _Buttons[10]=new JButton( _Images[10]);
             _Buttons[10].setName("oh");
             _Buttons[11]=new JButton( _Images[11]);
             _Buttons[11].setName("teeth");
              _Buttons[12]=new JButton( _Images[12]);
             _Buttons[12].setName("winktongue");

         //Adding the buttond to the panel
             for(int i=0;i<_size;i++)
             {
                 _Buttons[i].setPreferredSize(new Dimension(20, 20));
                 _Buttons[i].setBorder(new BevelBorder(BevelBorder.RAISED));
                 this.add(_Buttons[i]);
             }

         this.setBorder(new BevelBorder(BevelBorder.RAISED));
    }

}
